﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using agvcontroller.Process;
using agvcontroller.GUI;

namespace agvcontroller
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        CAGVController AGVC;

        UCMainInfomation UCMainInfo = new UCMainInfomation();
        UCSystemInfomaion UCSystemInfo = new UCSystemInfomaion();
        UCLogInfomation UCLogInfo = new UCLogInfomation();
        UCHelpInfomation UCHelpInfo = new UCHelpInfomation();

        UCMainSidePanel UCMainSide = new UCMainSidePanel();
        UCSystemSidePanel UCSystemSide = new UCSystemSidePanel();
        UCLogSidePanel UCLogSide= new UCLogSidePanel();
        UCHelpSidePanel UCHelpSide = new UCHelpSidePanel();

        public MainWindow()
        {
            InitializeComponent();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            AGVC = CAGVController.getInstance();

            RegistEvent();
            InitUI();
        }

        void InitUI()
        {
            bdInfo.Child = UCMainInfo;
        }

        void RegistEvent()
        {
            UCNavi.OnNaviChanged += new GUI.deleOnNaviChanged(UCNavi_OnNaviChanged);

            UCSystemSide.OnSideModeChanged += new deleUCSystemSideChanged(UCSystemSide_OnSideModeChanged);
        }

        void UCSystemSide_OnSideModeChanged(object sender, enumSystemMode mode)
        {
            UCSystemInfo.SetUIElement(mode);
        }

        void UCNavi_OnNaviChanged(object sender, GUI.enumNavigation mode)
        {
            switch (mode)
            {
                case enumNavigation.HOME:
                    bdInfo.Child = UCMainInfo;
                    bdSide.Child = UCMainSide;
                    break;
                case enumNavigation.SYSTEM:
                    bdInfo.Child = UCSystemInfo;
                    bdSide.Child = UCSystemSide;
                    break;
                case enumNavigation.LOG:
                    bdInfo.Child = UCLogInfo;
                    bdSide.Child = UCLogSide;
                    break;
                case enumNavigation.HELP:
                    bdInfo.Child = UCHelpInfo;
                    bdSide.Child = UCHelpSide;
                    break;
            }
        }
    }
}
